<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:s="http://www.w3.org/2003/05/soap-envelope"
    xmlns:drive="http://schemas.microsoft.com/robotics/2006/05/drive.html"
    xmlns:motor="http://schemas.microsoft.com/robotics/2006/05/motor.html"
    xmlns:physical="http://schemas.microsoft.com/robotics/2006/07/physicalmodel.html">

  <xsl:import href="/resources/dss/Microsoft.Dss.Runtime.Home.MasterPage.xslt" />

  <xsl:template match="/">
    <xsl:call-template name="MasterPage">
      <xsl:with-param name="serviceName">
        <img src="/resources/Integrator.Y2008.M01/ProMRDS.Robotics.Integrator.Resources.Integrator.Image.png" align="middle"/> Integrator Generic Drive
      </xsl:with-param>
      <xsl:with-param name="description">
        Provides access to the Integrator Drive (Uses the Generic Drive contract)
      </xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="s:Header">

  </xsl:template>

  <xsl:template match="drive:DriveDifferentialTwoWheelState">
    <table width="100%" border="0" cellpadding="5" cellspacing="5">
      <tr>
        <th colspan="2">
          Integrator Drive
        </th>
      </tr>
      <tr>
        <th width="20%">Enabled</th>
        <td width="80%">
          <xsl:value-of select="drive:IsEnabled"/>
        </td>
      </tr>
      <tr>
        <th width="20%">Drive State</th>
        <td width="80%">
          <xsl:value-of select="drive:DriveState"/>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <table width="100%" border="0" cellpadding="5" cellspacing="5">
            <tr>
              <th width="20%">Property</th>
              <th width="40%">Left Wheel</th>
              <th width="40%">Right Wheel</th>
            </tr>
            <tr>
              <th width="20%">
                Name:
              </th>
              <td width="40%">
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:Name"/>
              </td>
              <td width="40%">
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:Name"/>
              </td>
            </tr>
            <tr class="odd">
              <th width="20%">
                Identifier:
              </th>
              <td width="40%">
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:HardwareIdentifier"/>
              </td>
              <td width="40%">
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:HardwareIdentifier"/>
              </td>
            </tr>
            <tr>
              <th width="20%">
                Current Power:
              </th>
              <td width="40%">
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:CurrentPower"/>
              </td>
              <td width="40%">
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:CurrentPower"/>
              </td>
            </tr>
            <tr class="odd">
              <th width="20%">
                Power Scaling Factor:
              </th>
              <td width="40%">
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:PowerScalingFactor"/>
              </td>
              <td width="40%">
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:PowerScalingFactor"/>
              </td>
            </tr>
            <tr>
              <th width="20%">
                Reverse Polarity:
              </th>
              <td width="40%">
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:ReversePolarity"/>
              </td>
              <td width="40%">
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:ReversePolarity"/>
              </td>
            </tr>
            <tr>
              <th width="20%">Pose Position:</th>
              <td width="40%">
                (<xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:Pose/physical:Position/physical:X"/>,
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:Pose/physical:Position/physical:Y"/>,
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:Pose/physical:Position/physical:Z"/>)
              </td>
              <td width="40%">
                (<xsl:value-of select="drive:RightWheel/motor:MotorState/motor:Pose/physical:Position/physical:X"/>,
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:Pose/physical:Position/physical:Y"/>,
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:Pose/physical:Position/physical:Z"/>)
              </td>
            </tr>
            <tr>
              <th width="20%">Pose Orientation:</th>
              <td width="40%">
                (<xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:Pose/physical:Orientation/physical:X"/>,
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:Pose/physical:Orientation/physical:Y"/>,
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:Pose/physical:Orientation/physical:Z"/>,
                <xsl:value-of select="drive:LeftWheel/motor:MotorState/motor:Pose/physical:Orientation/physical:W"/>)
              </td>
              <td width="40%">
                (<xsl:value-of select="drive:RightWheel/motor:MotorState/motor:Pose/physical:Orientation/physical:X"/>,
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:Pose/physical:Orientation/physical:Y"/>,
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:Pose/physical:Orientation/physical:Z"/>,
                <xsl:value-of select="drive:RightWheel/motor:MotorState/motor:Pose/physical:Orientation/physical:W"/>)
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </xsl:template>
</xsl:stylesheet>
